﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class WindowManager : MonoBehaviour {
    private static WindowManager _instance;
    public static WindowManager Instance => _instance;

    public Canvas popUpPanelCanvas;
    public GameObject gameOverPanelPfb;

    private GameOverPanel gameOverPanel;

    Vector3 v3Zero = Vector3.zero;
    Vector3 v3OutScreen = new Vector3(10000f, 0f, 0f);
    public void Awake() {
        _instance = this;
    }
    public void ShowGameOverPanel(int score_) {
        if (!gameOverPanel) {
            var go = Instantiate(gameOverPanelPfb, popUpPanelCanvas.transform);
            gameOverPanel = go.GetComponent<GameOverPanel>();
        }
        gameOverPanel.SetSocre(score_);
        gameOverPanel.SetPos(v3Zero);
        popUpPanelCanvas.enabled = true;
    }
    public void CloseGameOverPanel() {
        gameOverPanel.SetPos(v3OutScreen);
        popUpPanelCanvas.enabled = false;
    }
}
